<?php
class APILayout extends BaseController_Controller {

	
	public function __construct()
	{			
			parent::__construct();		
			
			$this->load->library('sys/sysmenu');	
			$this->load->library('sys/sysmodule');
	}	
	
	function loadnav()
	{		
		//$this->output->enable_profiler(TRUE);
		$mn=new SysMenu();	
		echo json_encode($mn->GetTreeMenu(SysModule::Inquiry(false,'moduleindex')));								
	}

	function getbreadcrumbdata($menuid)
	{
		//$this->output->enable_profiler(TRUE);	  
		$this->getbread($menuid,$this->breaddata);
		echo json_encode (array_reverse($this->breaddata));
	}	
	
	function getbread($mnid,&$bd)
	{	
		$mn=new SysMenu($mnid);
		if($mn){
			
			if($mn->menuheader!=''){			
				$bd[$mn->menuid]=$mn;	
				$this->getbread($mn->menuheader,$bd);			
			}
		}
	}

	

	

} 
